package com.gao.web.service;

import com.gao.web.dao.MessageMapper;
import com.gao.web.pojo.Message;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MessageService {
    @Autowired
    private MessageMapper messageMapper;

    public List<Message> findContent(String username, String content) {
        return messageMapper.findContent(username, content);
    }

    public List<Message> messagefindall() {
        return messageMapper.messagefindAll();
    }

    public int insertMessage(String username, String content, String post_date) {
        Message message = new Message(username, content, post_date);
        return messageMapper.insertMessage(message);
    }

    public int delete(int id) {
        Message message = messageMapper.selectById(id);
        return messageMapper.delete(message);
    }
}
